package com.able.concurrency.t4;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedDeque;

/**
 * @author abel.he
 * @data 2018/10/25 15:26
 * @describe 队列： 列表实现的 基础链表同步队列
 */
public class Test3_ConcurrentLinkedQueue {

    public static void main(String[] args) {
        Queue<String> queue = new ConcurrentLinkedDeque<String>();

        for (int i = 0; i < 10; i++) {
            // 存值
            queue.offer("value" + i);
        }

        System.out.println(queue);
        System.out.println(queue.size());

        // peek() 获取元素的首行数据
        System.out.println(queue.peek());
        System.out.println(queue.size());

        // poll() 取出首行数据
        System.out.println(queue.poll());
        System.out.println(queue.size());

    }

}
